"""微信公众平台API异常类"""

from ..common.exceptions import APIError, AuthenticationError


class WeChatError(APIError):
    """微信API基础异常"""
    
    def __init__(self, message, errcode=None, response=None):
        self.errcode = errcode
        super().__init__(message, code=errcode, response=response)


class WeChatAuthError(AuthenticationError, WeChatError):
    """微信认证错误"""
    
    def __init__(self, message="微信认证失败", errcode=401, response=None):
        super().__init__(message, errcode=errcode, response=response)


class WeChatAccessTokenError(WeChatAuthError):
    """AccessToken错误"""
    
    def __init__(self, message="AccessToken获取失败", errcode=40001, response=None):
        super().__init__(message, errcode=errcode, response=response)


class WeChatAPIQuotaError(WeChatError):
    """API调用配额错误"""
    
    def __init__(self, message="API调用配额不足", errcode=45009, response=None):
        super().__init__(message, errcode=errcode, response=response)